/**
 * @param {Number} errCode - 状态码
 * @param {Boolean || String || Object} data - 返回内容
 */

module.exports = {
    monkeyResult(errCode, data = '') {

        const argumentsLength = arguments.length;

        if (argumentsLength === 0 || !this.helper.isZParseInt(errCode)) {
            this.body = 'null';
            return;
        };

        let errMsg = this.app.config.codeMessage[errCode.toString()] || '';

        if (argumentsLength === 1) {
            this.body = {
                errCode,
                errMsg
            };
            return;
        };

        if (this.helper.isBoolean(data)) { //是否为布尔值
            this.body = {
                errCode,
                errMsg,
                isSuccess: data
            };
        } else {
            this.body = {
                errCode,
                errMsg,
                data
            };
        }

    }
}